/*
 * @Description: 
 * @Author: changqing
 * @Date: 2021-08-30 11:59:10
 * @LastEditTime: 2021-08-30 12:00:51
 * @LastEditors: changqing
 * @Usage: 
 */
var { timer, interval } = require('rxjs'); 
var {take,last} = require('rxjs/operators');
const source = timer(0, 1000).pipe(take(10));

source.pipe(
  last()
)
.subscribe(data => {
  console.log(`${data}`);
});

source.pipe(
  last(data => data < 8)
)
.subscribe(data => {
  console.log(`${data}`);
});